﻿#region

using System.Collections.ObjectModel;
using System.Data.Objects.DataClasses;
using System.Linq;

#endregion

namespace Core.DAO
{
    public interface IDAO<TEntity> where TEntity : EntityObject
    {
        /// <summary>
        ///     Add object into database
        /// </summary>
        /// <para name="obj"></para>
        int Add(TEntity obj);

        /// <summary>
        ///     Delete object from database
        /// </summary>
        /// <para name="obj"></para>
        int Delete(TEntity obj);

        /// <summary>
        ///     Update object from database
        /// </summary>
        /// <para name="obj"></para>
        int Update(TEntity obj);

        /// <summary>
        ///     Receive list object from database by query
        /// </summary>
        /// <para name="query"></para>
        /// <returns></returns>
        ReadOnlyCollection<TEntity> GetByQuery(IQueryable<TEntity> query);

        /// <summary>
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        IQueryable<TEntity> Search(string query);
    }
}